<?php
require_once($_SERVER["DOCUMENT_ROOT"].'/Mobile_Detect.php');
require_once($_SERVER["DOCUMENT_ROOT"].'/utils.php');

if (!isset($lang)) {
	$langfile = $_SERVER["DOCUMENT_ROOT"].'/lang/default.xml';
	switch ($_SERVER['HTTP_HOST']){
		case "127.0.0.1:30000":
			$langfile = $_SERVER["DOCUMENT_ROOT"].'/lang/127.0.0.1.xml';
			break;
	}
	if (file_exists($langfile)) {
		$lang = simplexml_load_file($langfile);
	} else {
		exit('please create a language file for this domain.');
	}	
}

if (!isset($detect)) {
	$detect = new Mobile_Detect();
}
?>

<div data-role="dialog" id="popup" data-url="popup" data-dom-cache="true">
	<div data-role="content">
		<div class="dialog-form">
			<h1><?php echo($lang->mobile->dialog->h1) ?></h1>

			<div class="gradient">
				<?php if($detect->isTablet()) { ?>
				<!--
				<div class="talk">
				<a data-role="button" data-transition="fade" href="<?php echo(hostname()."/iframe.php") ?>" data-inline="true" data-rel="dialog" ><?php echo($lang->buttons->talktous) ?></a>
				<br/><br/>or
				</div>
				-->
				<?php } ?>
				<br/>
				<div class="copy"><?php echo($lang->mobile->dialog->text) ?></div>
				<form id="callAjaxForm">
					<div data-role="fieldcontain">
						<input id="email" name="email" placeholder="Enter your email address here" value="" type="email" />
						<input type="submit" value="SUBMIT" id="submit" <?php if($detect->isTablet()) echo ('data-inline="true"'); ?> />
					</div>
	            </form>
			</div>
		</div>
		<div class="dialog-thanks">
			<h1><?php echo($lang->mobile->dialog->thanks->h1) ?></h1>

			<div class="gradient">
				<div class="copy"><?php echo($lang->mobile->dialog->thanks->copy) ?></div>
			</div>
		</div>
	</div>
</div>